package com.sun.androidexerciseproject.widget.activity.ui;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.sun.androidexerciseproject.widget.R;

import java.util.ArrayList;

public class WebviewTestActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_webview_test);
        final WebView webView = (WebView) findViewById(R.id.web);

        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl("http://www.baidu.com");
        // webView.loadData("Test</br>Test</br>Test</br>Test</br>Test</br>Test", "text/html", "utf-8");

        final ListView list = (ListView) findViewById(R.id.list);
        int count = 40;
        ArrayList<String> data = new ArrayList<String>(count);
        for (int i = 0; i < count; i++) {
            data.add("Text " + i);
        }
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_expandable_list_item_1, data);
        TextView header = new TextView(this);
        header.setText("Header");
        list.addHeaderView(header);
        list.setAdapter(adapter);
    }

}
